//using PK.InAppPurchase;
using System.Collections;
using UnityEngine;
using UnityEngine.Events;

namespace PKGames
{
    public class IapCreativeManager : MonoSingleton<IapCreativeManager>
    {
        [SerializeField]
        private IapCreativeUiController _iapCreativeUiController;

        //public void SetupIapCreative(Sprite sprite, StoreProduct storeProduct, string levelName)
        //{
        //    _iapCreativeUiController.Setup(sprite, storeProduct, levelName);
        //}

        public void ShowIapCreative(IapCreativeUiController.IapTrigger iapTrigger, float fadeTime, UnityAction onClose)
        {
            StartCoroutine(ShowIapCreativeAsync(iapTrigger, fadeTime, onClose));
        }

        public IEnumerator ShowIapCreativeAsync(IapCreativeUiController.IapTrigger iapTrigger, float fadeTime, UnityAction onClose)
        {
            yield return _iapCreativeUiController.ShowIapCreativePopup(iapTrigger, fadeTime, onClose);
        }

        public void CloseIapCreative(float fadeTime = 0.15f)
        {
            StartCoroutine(CloseIapCreativeAsync(fadeTime));
        }

        public IEnumerator CloseIapCreativeAsync(float fadeTime)
        {
            yield return _iapCreativeUiController.Close(fadeTime);
        }
    }
}
